﻿using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.Extensions.Options;

using System.Text.Encodings.Web;
using System.Threading.Tasks;

namespace MyMvc.Custom
{
    public class CustomRemoteHandler //: RemoteAuthenticationHandler<CustomRemoteOptions>
    {
        //public CustomRemoteHandler(IOptionsMonitor<CustomRemoteOptions> options, ILoggerFactory logger, UrlEncoder encoder) : base(options, logger, encoder)
        //{
        //}

        //protected override Task HandleChallengeAsync(AuthenticationProperties properties)
        //{
        //    string state = Options.StateDataFormat.Protect(properties);
        //    return Task.CompletedTask;
        //    // Then add the state to the URI.
        //}

        //protected override async Task<HandleRequestResult> HandleRemoteAuthenticateAsync()
        //{
        //    var state = Request.Query["state"];

        //    var properties = Options.StateDataFormat.Unprotect(state);
        //    if (properties == null)
        //    {
        //        return HandleRequestResult.Fail("The Custom authentication state was missing or invalid.");
        //    }
        //    return HandleRequestResult.NoResult();
        //    //return HandleRequestResult.Success();
        //}

        //protected override bool ValidateCorrelationId(AuthenticationProperties properties)
        //{
        //    return true;// base.ValidateCorrelationId(properties);
        //}
    }
}
